package com.langsotech.studio.project.wizard.project;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.internal.core.BundleHost;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
public class HiCorePlugin extends AbstractUIPlugin {
	public static final String PLUGIN_ID = "org.hi.studio.core";
	private static HiCorePlugin plugin;
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}
	public static HiCorePlugin getDefault() {
		return plugin;
	}
	public static ImageDescriptor getImageDescriptor(String path) {
		return imageDescriptorFromPlugin("org.hi.studio.core", path);
	}
	public static String getCurrentPluginDirectory() {
		BundleHost bundleHost = (BundleHost) getDefault().getBundle();
		BaseData data = (BaseData) bundleHost.getBundleData();
		String currentDir = data.getBundleFile().getBaseFile()
				.getAbsolutePath();
		return currentDir;
	}
}
